Skip to content

Fix #581: SpooledStringIO.rollover() skips unread text after readline() - #591

Closed
RudraBhaskar9439 wants to merge 1 commit into
mahmoud:masterfrom
RudraBhaskar9439:atlas/issue-581-cb637dae-b4aa0564
Closed

RudraBhaskar9439 wants to merge 1 commit into
mahmoud:masterfrom
RudraBhaskar9439:atlas/issue-581-cb637dae-b4aa0564

Conversation

@RudraBhaskar9439

Copy link
Copy Markdown

Fix SpooledStringIO.rollover() to preserve reading position by tracking and restoring the character position before and after copying to the new buffer.

Closes #581

Base commit: 4e5faa3d7e4008d89e0d8bf1ea87b6d9a061a16d
Evidence: GH-037003a080a94b1a2a63-581@1

Validation: Unverified draft: native checks are not_started. Recorded head: e1f1107fba3b072c109b6e6dce02b30d102541cc. Latest run: None. The author explicitly approved draft publication with these results. This change needs passing checks and maintainer review before merging.

Prepared with AI assistance in Atlas and explicitly reviewed for draft publication.

  • The issue occurs because rollover() copies bytes and seeks the new stream to the raw byte position, but the TextIOWrapper's read buffer is lost.
  • The fix saves the character position (self._tell) before rollover, performs the copy, then seeks to that character position using the existing seek() logic.
  • A regression test is added to verify that reading after rollover following readline() returns the correct unread text.

mahmoud added a commit that referenced this pull request Oct 25, 2026
@mahmoud

mahmoud commented Oct 25, 2026

Copy link
Copy Markdown
Owner

Folded into #609 (see the PR description for credit). Thanks for the report and the repro.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SpooledStringIO.rollover() skips unread text after readline()

2 participants